#include<iostream>
using namespace std;

int search(int a[],int n,int key);
template <class T>int length(T &arr);
int main()
{
    int array[]={0,2,3,4,5};
    int key=3,result;
    result=search(array,length(array),key);
    cout<<"查找结果:"<<result<<endl;
}
int search(int a[],int n,int key)
{
    a[0]=key;
    int result;
    for (int i = n; a[i]!=key; i--)
    {
        result=i;
    }
    return result;
}
template <class T>int length(T &arr)
{
    return sizeof(arr)/sizeof(arr[0]);
}